#pragma once
#include <nice2d/widgets/control.h>
#include <nice2d/widgets/controlradioselector.h>

class RadioBoxStyle : public ControlStyle
{
    DECLARE_OBJECT(RadioBoxStyle)
public:
    RadioBoxStyle();

    PTree serialize()override;
    void deserialize(const PTree &node)override;
    void sync()override;

    std::shared_ptr<ControlStyle> selectedStyle;
};

class RadioBox : public Control
{
    DECLARE_OBJECT(RadioBox)
public:
    RadioBox() = delete;
    RadioBox(std::shared_ptr<ControlRadioSelector> selector);
    ~RadioBox();
public:
    bool isSelected();
    void selected();

    void unselected(ControlPointer control);
    void selected(ControlPointer control);
private:
    void onMouseEnter() override;
    void onMouseExit() override;
    void onMousePressed(sf::Mouse::Button button)override;
    void onUpdateControl(float deltaTime)override;
    void onStyleChanged()override;
private:
    std::unique_ptr<class RadioBoxData> data;
};
